package com.hainingtong.user.dto;

import com.hainingtong.user.dto.group.DefaultGroup;
import com.hainingtong.user.dto.group.PhoneCodeGroup;
import com.hainingtong.user.dto.group.UsernamePasswordGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@ApiModel("手机号注册")
@EqualsAndHashCode(callSuper = true)
@Data
public class RegisterUserPhoneCodeDto extends RegisterUserDto{
    @ApiModelProperty("手机收到的验证码")
    @NotNull(groups = DefaultGroup.class, message = "验证码不能为空")
    @Pattern(groups = PhoneCodeGroup.class, regexp = "\\d{4}", message = "验证码是4位数字")
    private String code;

    @ApiModelProperty("获取注册验证码时返回的32位字符串")
    @Pattern(groups = PhoneCodeGroup.class, regexp="[\\da-z]{32}", message = "验证码 id 是一个32位字符串")
    private String id;
}
